﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace WEALTH
{
    public partial class ProductDetail : System.Web.UI.Page
    {
        private ExcuteDao dao = new ExcuteDao();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {                
                if (!string.IsNullOrEmpty(Request.QueryString["CPID"]))
                {   
                    SetInitData();
                }
            }
        }
        /// 设置初始化页面信息
        /// </summary>
        private void SetInitData()
        {
            //获取产品信息
            DataTable dtProduct = dao.Get_ProductByID(Convert.ToInt32(Request.QueryString["CPID"]));
            if (dtProduct.Rows.Count > 0)
            {
                //产品全称
                txtCPName.Text = SpecialCharHandler.HtmlDiscode(dtProduct.Rows[0]["CPName"].ToString());
                //发行机构
                txtCPFXJG.Text = SpecialCharHandler.HtmlDiscode(dtProduct.Rows[0]["CPFXJG"].ToString());
                //产品状态
                ddlCPStatus.Text = dtProduct.Rows[0]["CPStauts"].ToString();
                //产品类型
                txtCPType.Text = SpecialCharHandler.HtmlDiscode(dtProduct.Rows[0]["CPType"].ToString());
                //投资领域
                txtCPTZLY.Text = SpecialCharHandler.HtmlDiscode(dtProduct.Rows[0]["CPTZLY"].ToString());
                //产品期限
                txtCPQX.Text = dtProduct.Rows[0]["CPQX"].ToString();
                //发行规模
                txtCPFXGM.Text = dtProduct.Rows[0]["CPGM"].ToString();
                //投资起点
                txtCPTZQD.Text = dtProduct.Rows[0]["CPQD"].ToString();
                //预期年收益率
                txtCPSYFrom.Text = dtProduct.Rows[0]["CPSYFrom"].ToString();
                txtCPSYTo.Text = dtProduct.Rows[0]["CPSYTo"].ToString();
                //产品亮点
                txtCPLD.Text = SpecialCharHandler.HtmlDiscode(dtProduct.Rows[0]["CPLD"].ToString());
                //收益率说明
                txtCPSYLSM.Text = SpecialCharHandler.HtmlDiscode(dtProduct.Rows[0]["CPSYLSM"].ToString());
                //资金运用
                txtCPZJYY.Text = SpecialCharHandler.HtmlDiscode(dtProduct.Rows[0]["CPZJYY"].ToString());
                //风险控制
                txtCPFXKZ.Text = SpecialCharHandler.HtmlDiscode(dtProduct.Rows[0]["CPFXKZ"].ToString());
                //其他说明
                txtCPAbout.Text = SpecialCharHandler.HtmlDiscode(dtProduct.Rows[0]["CPabout"].ToString());
                //付息方式
                txtCPFXFS.Text = SpecialCharHandler.HtmlDiscode(dtProduct.Rows[0]["CPFXFS"].ToString());
                //发售日期
                txtCPFSRQ.Text = dtProduct.Rows[0]["CPFSRQ"].ToString();
                //成立日
                txtCPCLR.Text = dtProduct.Rows[0]["CPCLR"].ToString();
                //到期日
                txtCPDQR.Text = dtProduct.Rows[0]["CPDQR"].ToString();

            }
        }
    }
}